package cn.iocoder.yudao.framework.web.config;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

import java.util.List;


/**
 *
 * MVC配置，配置拦截器和静态资源映射
 * @author sdzq
 */
@Configuration
public class WebMvcConfig extends WebMvcConfigurerAdapter {
/*	@Autowired
    private UrlInterceptor urlInterceptor;*/
	
    @Value("${upload-path}")
    public  String uploadPath;
    @Value("${video-path}")
    public  String videoPath;
    
  /*  @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //拦截APP端url实现token身份验证
        registry.addInterceptor(urlInterceptor).addPathPatterns("/**");
        //拦截所有url，记录访问log日志
        registry.addInterceptor(new LogInterceptor()).addPathPatterns("/**");
    }*/

   /* @Override
    public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
    }*/

    /**
     * 自定义静态资源映射目录
     */
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        //自定义静态资源映射目录,将前端访问路径/myFiles/**，映射为服务器上的以下目录
    	registry.addResourceHandler("/myFiles/**").addResourceLocations("file:"+uploadPath,"file:"+videoPath);
    	super.addResourceHandlers(registry);
    }





}